home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir42 / c7105.zip / LIST.TPX < prev    next >
Text File  |  1994-03-02  |  26KB  |  543 lines

  1. #!┌───────────────────────────┤Template Segment├───────────┬─────────────────┐
  2. #!│                                List.TPX                │Version: 3007.105│
  3. #!├───────────────────────────────┤Contents├───────────────┴─────────────────┤
  4. #!│Structure             Type       Description                              │
  5. #!│────────────────────  ─────────  ─────────────────────────────────────────│
  6. #!│List                  PROCEDURE  Scroll records from a file from a memory │
  7. #!│                                 queue                                    │
  8. #!│ShowFileProgress      GROUP                                               │
  9. #!│ListErrorCheck        GROUP                                               │
  10. #!│BuildListIndex        GROUP                                               │
  11. #!├───────────────────────────────┤Comments├─────────────────────────────────┤
  12. #!│Version   Comments                                                        │
  13. #!│────────  ────────────────────────────────────────────────────────────────│
  14. #!│3007.000  Release of CDD3 version 3007 templates                          │
  15. #!│3007.103  Repaired the LIST Procedure                                     │
  16. #!│3007.105  Repaired the LIST Procedure                                     │
  17. #!└──────────────────────────────────────────────────────────────────────────┘
  18. #!
  19. #PROCEDURE(List,'Scroll all selected records from a file'),SCREEN,PULLDOWN
  20. #!
  21. #!┌──────────────────────────┤Procedure Template├──────────┬─────────────────┐
  22. #!│                                  List                  │Version: 3007.103│
  23. #!├──────────────────────────────┤Description├─────────────┴─────────────────┤
  24. #!│  The List template loads the entire set of selected records into         │
  25. #!│  a memory queue for displaying with a list box structure.                │
  26. #!│                                                                          │
  27. #!│  Since the entire queue is filled at load time, this template should     │
  28. #!│  not be used with very large files as they may overflow the primary      │
  29. #!│  virtual memory area and spill over to disk.  The result would be        │
  30. #!│  a listbox which works very slow and accesses the hard disk drive when   │
  31. #!│  scrolling.                                                              │
  32. #!│                                                                          │
  33. #!│  A checkbox is available to view a file in Record order. This is         │
  34. #!│  primarily useful in viewing ASCII, DOS, or BASIC files.                 │
  35. #!│  (The View template may also be used.)                                   │
  36. #!│                                                                          │
  37. #!│  If the Record Order checkbox is on, any reference to the                │
  38. #!│  PrimaryKey is ignored.  Deletes, and Updates may not be allowed         │
  39. #!│  with certain non-keyed data file types.                                 │
  40. #!│                                                                          │
  41. #!│  Also, a checkbox is available to display the queue in reverse           │
  42. #!│  order.  If both the Record Order checkbox, and the Reverse Order        │
  43. #!│  checkbox are on then the file will be displayed in Reverse record       │
  44. #!│  order.  If Just the Reverse Order checkbox is on, the file              │
  45. #!│  will be displayed in Reverse key order.                                 │
  46. #!│                                                                          │
  47. #!│  Use with an Update Procedure:                                           │
  48. #!│                                                                          │
  49. #!│  Since a Form template allows the multiple add ability, and              │
  50. #!│  since a List procedure may be used on a network, a checkbox             │
  51. #!│  has been added to control the rebuilding of the queue upon              │
  52. #!│  return from the Update Procedure.  When checked, the queue              │
  53. #!│  will always be rebuilt to accomodate any updates made by other          │
  54. #!│  network file users, or multiple record adds by another procedure.       │
  55. #!├───────────────────────────────┤Comments├─────────────────────────────────┤
  56. #!│Version   Comments                                                        │
  57. #!│────────  ────────────────────────────────────────────────────────────────│
  58. #!│3007.000  Release of CDD3 version 3007 templates                          │
  59. #!│3007.103  Added 'Process Selected Record' code in the CASE FIELD() of List│
  60. #!│          code, specifically to be used if the Hot Fields are enable.     │
  61. #!│3007.105  Competed support for PullDowns                                  │
  62. #!└──────────────────────────────────────────────────────────────────────────┘
  63. #!
  64. #PROMPT('Range &Limit Field',COMPONENT),%KeyRangeField
  65. #PROMPT('Range &Value Field',FIELD),%RangeValue
  66. #PROMPT('Record Filter',@S180),%RecordFilter
  67. #PROMPT('Upd&ate Procedure',PROCEDURE),%UpdateProc
  68. #PROMPT('Enable Hot Records',CHECK),%HotBar
  69. #PROMPT('&Queue Rebuild',CHECK),%QueueRebuild
  70. #PROMPT('Record Order',CHECK),%RecordOrder
  71. #PROMPT('Reverse Order',CHECK),%ReverseOrder
  72. #PROMPT('Progress &Indicator',CHECK),%ShowProg
  73. #PROMPT('Progress &Character',@S8),%ProgChar
  74. #PROTOTYPE('')
  75. #INSERT(%StandardHeader)
  76. #INSERT(%SetBrowseSymbols)
  77. #INSERT(%ListErrorCheck)
  78.  
  79. %Procedure       PROCEDURE
  80.  
  81. Queue            QUEUE                           !Listbox Queue contains
  82. FilePointer      Ulong
  83. #FIX(%File,%Primary)
  84. #FIX(%Key,%PrimaryKey)
  85. #SET(%FirstField, %Null)
  86. #FOR(%KeyField)
  87. QUE::%KeyField    LIKE(%KeyField)              #<! And Key element(s) for sort
  88.   #IF(%FirstField = %Null)
  89.     #SET(%FirstField, %KeyField)
  90.     #SET(%FirstFieldSequence, %KeyFieldSequence)
  91.   #ENDIF
  92.   #IF(%RecordOrder = %Null)
  93.     #IF(%KeyFieldSequence <> 'DESCENDING' AND %ReverseOrder = %Null)
  94.       #SET(%SortString, (CLIP(LEFT(%SortString)) & ',+QUE::' & %KeyField))
  95.     #ELSE
  96.       #SET(%SortString, (CLIP(LEFT(%SortString)) & ',-QUE::' & %KeyField))
  97.     #ENDIF
  98.   #ENDIF
  99. #ENDFOR
  100. #IF((%RecordOrder AND %ReverseOrder))
  101.   #SET(%SortString,(','& %FixRows+1))
  102. #ENDIF
  103. #FIX(%ScreenField,'?LIST')
  104. Line             STRING(%ScreenFieldQueueSize) #<! Line to be scrolled
  105.                  .
  106. #INSERT(%SetupKeyRangeFields)
  107. ButtonIsDisabled BYTE                            !Flag to allow button enable
  108. #INSERT(%FileControl)
  109. InitialLoad      BYTE(1)
  110. %LocalData
  111. %ScreenStructure
  112. #IF(%PullDown)
  113. %PulldownStructure
  114. SAV::PullDownOpened BYTE(0)
  115. #ENDIF
  116. #EMBED('Data Section')
  117.  
  118. PreUpdateCount   ULONG                           !Records in file count.
  119. FirstPage        BYTE                            !First page flag
  120. #IF(%ShowProg)
  121. VEW::Length      BYTE                            ! Progress variable
  122. VEW::ProgString  STRING('<176>{80}')             ! Progress display variable
  123. #ENDIF
  124.  
  125.   CODE
  126.   #EMBED('Setup Procedure')
  127.   #INSERT(%FileControl)
  128.   OPEN(Screen)                                   !Open the screen
  129.   #EMBED('Setup Screen')
  130.   DISPLAY                                        !Display screen fields
  131.   #IF(%Pulldown)                                #!If a Pulldown exists
  132.   OPEN(%Pulldown)                              #<!Open the Pulldown
  133.   SAV::PullDownOpened = True
  134.   #EMBED('Setup Pulldown')
  135.   #ENDIF
  136.   #INSERT(%BuildListIndex)
  137.  
  138.   IF ?LIST = %FirstEntryField                  #<!If no entry for ranges
  139.     DO FillQueue                                 ! Fill the QUEUE
  140.     IF RECORDS(Queue) = %FixRows               #<! If no QUEUE records
  141.   #IF(%InsertExists)
  142.       SELECT(?Insert)                            !  Select the Insert button
  143.   #ELSIF(%UpdateProc)
  144.       #INSERT(%RestoreRangeFields)
  145.       SETKEYCODE(InsKey)                         ! Set action to Insert
  146.       Do UpdateProcedure                         ! Call the update procedure
  147.       DO FillQueue                               !  Fill the QUEUE
  148.       IF RECORDS(Queue) = %FixRows             #<!  If still no records
  149.         DO ProcedureReturn
  150.       END                                        !  End IF
  151.   #ELSE
  152.       DO ProcedureReturn
  153.   #ENDIF
  154.     END                                          !  End IF
  155.   END                                            !End IF
  156.   #IF(%HotBar)
  157.     #SET(%FirstRecordRow,(%FixRows+1))
  158.   GET(Queue,%FirstRecordRow)
  159.   GET(%Primary,FilePointer)
  160.   DISPLAY()
  161.   #ENDIF
  162.   LOOP                                           !Screen handling loop
  163.   #FOR(%Formula)
  164.     #IF(UPPER(%FormulaClass) <> 'LIST')
  165.       #IF(UPPER(%FormulaClass) <> 'FILTER')
  166.     #INSERT(%GenerateFormula)
  167.       #ENDIF
  168.     #ENDIF
  169.   #ENDFOR
  170.     #EMBED('End of General Formulas')
  171.     CASE SELECTED()                              !Jump to field setup routine
  172.       #INSERT(%ScreenSetupRoutines)
  173.     END                                          !End CASE
  174.     ACCEPT                                       !Enable the keyboard
  175.     CASE KEYCODE()                               !Jump to hotkey procedures
  176.     #FOR(%HotKey)
  177.     OF %HotKey                                   !User defined HotKey
  178.       %HotKeyProc                                !HotKey Procedure
  179.     #ENDFOR
  180.     #FIX(%ScreenField,'?Exit')
  181.     #IF(%ScreenField)
  182.     OF EscKey
  183.       IF FIELD() <> ?Exit
  184.         SELECT(?Exit)
  185.         PRESS(EnterKey)
  186.         CYCLE
  187.       END
  188.     #ENDIF
  189.     END                                          !End CASE
  190.     IF REFER() AND SELECTED() = ?List |          !If list field is selected
  191.        AND FIELD() < ?List                       ! From a prior changed field
  192.       DO FillQueue                               !  Fill the QUEUE
  193.     END                                          !End IF
  194.     CASE FIELD()                                 !Jump to edit routine
  195.   #FOR(%ScreenField)
  196.     #IF(%ScreenField = '?Insert')
  197.       #IF(%UpdateProc)
  198.     OF ?Insert                                   !Process the Insert Button
  199.         #IF(%ScreenFieldEdit)
  200.       %ScreenFieldEdit                         #<! Insert button Edit Routine
  201.         #ENDIF
  202.       GET(%Primary,0)                          #<! Dereference current record
  203.       #INSERT(%ClearFileFields)
  204.       #INSERT(%RestoreRangeFields)
  205.       PreUpdateCount = Records(%Primary)       #<! Save a record count
  206.       SETKEYCODE(InsKey)                         ! Set action to Insert
  207.       Do UpdateProcedure                         ! Call the update procedure
  208.         #IF(%QueueRebuild)
  209.       Do FillQueue                               ! Fill the QUEUE
  210.         #ELSE
  211.       CASE RECORDS(%Primary)                   #<! Check the record count
  212.       OF PreUpdateCount                          !  If no change
  213.         SELECT(?List)                            !   Reselect the list box
  214.       OF PreUpdateCount + 1                      !  If 1 record added
  215.           #FIX(%ScreenField,'?List')
  216.         Line = %ScreenFieldExpression          #<!   Fill the QUEUE line
  217.         FilePointer = POINTER(%Primary)        #<!   Save the file pointer
  218.         #INSERT(%FillKeyValues)
  219.         ADD(Queue %SortString)                 #<!   Add the record sorted
  220.       ELSE                                       !  Otherwise
  221.         Do FillQueue                             !   Rebuild the QUEUE
  222.       END                                        !  End CASE
  223.         #ENDIF
  224.       SELECT(?List)                              ! Reselect the List field
  225.       #ENDIF
  226.     #ENDIF
  227.     #IF(%ScreenField = '?Change')
  228.       #IF(%UpdateProc)
  229.     OF ?Change                                   !Process the Change Button
  230.         #IF(%ScreenFieldEdit)
  231.       %ScreenFieldEdit                         #<! Change button Edit Routine
  232.         #ENDIF
  233.       GET(Queue,CHOICE(?List))                   !Get the QUEUE element
  234.       GET(%Primary,FilePointer)                #<!Get the record
  235.       SETKEYCODE(EnterKey)                       ! Set action to Change
  236.       Do UpdateProcedure                         ! Call the update procedure
  237.         #IF(%QueueRebuild)
  238.       Do FillQueue                               !  Fill the QUEUE
  239.         #ENDIF
  240.         #IF(%HotBar)
  241.       GET(Queue,CHOICE(?List))                   !Get the QUEUE element
  242.       GET(%Primary,FilePointer)                #<!Get the record
  243.         #ENDIF
  244.       SELECT(?List)                              ! Reselect the List field
  245.       #ENDIF
  246.     #ENDIF
  247.     #IF(%ScreenField = '?Delete')
  248.       #IF(%UpdateProc)
  249.     OF ?Delete                                   !Process the Delete Button
  250.         #IF(%ScreenFieldEdit)
  251.       %ScreenFieldEdit                         #<! Delete button Edit Routine
  252.         #ENDIF
  253.       GET(Queue,CHOICE(?List))                   ! Get the QUEUE element
  254.       GET(%Primary,FilePointer)                #<! Get the record
  255.       SETKEYCODE(DelKey)                         ! Set action to Delete
  256.       Do UpdateProcedure                         ! Call the update procedure
  257.         #IF(%QueueRebuild)
  258.       Do FillQueue                               !  Fill the QUEUE
  259.         #ENDIF
  260.         #IF(%HotBar)
  261.       GET(Queue,CHOICE(?List))                   ! Get the QUEUE element
  262.       GET(%Primary,FilePointer)                #<! Get the record
  263.         #ENDIF
  264.       SELECT(?List)                              ! Reselect the List field
  265.       #ENDIF
  266.     #ENDIF
  267.     #IF(%ScreenField = '?List')
  268.     OF ?List                                     !Process the list field
  269.       #IF(%HotBar)
  270.       GET(Queue,CHOICE(?List))                   !  Get the QUEUE element
  271.       GET(%Primary,FilePointer)                #<!  Get the record
  272.       #ENDIF
  273.       #IF(%ScreenFieldEdit)
  274.       %ScreenFieldEdit                         #<! Exit button Edit Routine
  275.       #ENDIF
  276.       #IF(%HotBar)
  277.       #EMBED('Process Selected Record')
  278.       DISPLAY()                                #<!  Display the hot fields
  279.       #ENDIF
  280.       #IF(%UpdateProc)
  281.       CASE KEYCODE()                             ! Jump to keycode routine
  282.         #IF(%NoButtonsExist OR %InsertExists)
  283.       OF InsKey                                  ! For the insert key
  284.         GET(%Primary,0)                        #<!  Dereference current record
  285.         #INSERT(%ClearFileFields)
  286.         #INSERT(%RestoreRangeFields)
  287.         PreUpdateCount = Records(%Primary)       #<! Save a record count
  288.         Do UpdateProcedure                         ! Call the update procedure
  289.           #IF(%QueueRebuild)
  290.         Do FillQueue                               ! Fill the QUEUE
  291.           #ELSE
  292.         CASE RECORDS(%Primary)                   #<! Check the record count
  293.         OF PreUpdateCount                          !  If no change
  294.           SELECT(?List)                            !   Reselect the list box
  295.         OF PreUpdateCount + 1                      !  If 1 record added
  296.             #FIX(%ScreenField,'?List')
  297.           Line = %ScreenFieldExpression          #<!   Fill the QUEUE line
  298.           FilePointer = POINTER(%Primary)        #<!   Save the file pointer
  299.           #INSERT(%FillKeyValues)
  300.           ADD(Queue %SortString)                 #<!   Add the record sorted
  301.         ELSE                                       !  Otherwise
  302.           Do FillQueue                             !   Rebuild the QUEUE
  303.         END                                        !  End CASE
  304.           #ENDIF
  305.         SELECT(?List)                              ! Reselect the List field
  306.         #ENDIF
  307.         #IF(%NoButtonsExist OR %DeleteExists)
  308.       OF DelKey                                  ! For the delete key
  309.         PreUpdateCount = Records(%Primary)       !  Save a record count
  310.         GET(Queue,CHOICE(?List))                 !  Get the QUEUE element
  311.         GET(%Primary,FilePointer)              #<!  Get the record
  312.         Do UpdateProcedure                       ! Call the update procedure
  313.           #IF(%QueueRebuild)
  314.         Do FillQueue                             !  Fill the QUEUE
  315.           #ELSE
  316.         IF RECORDS(%Primary) = PreUpdateCount -1 #<! If the record was deleted
  317.           DELETE(Queue)                          !  Delete the Queue entry
  318.         END                                      ! End IF
  319.           #ENDIF
  320.         #ENDIF
  321.         #IF(%HotBar)
  322.         GET(Queue,CHOICE(?List))                 ! Get the QUEUE element
  323.         GET(%Primary,FilePointer)              #<! Get the record
  324.         #ENDIF
  325.         #IF(%NoButtonsExist OR %ChangeExists )
  326.       OF EnterKey                                ! Or the enter key
  327.       OROF MouseLeft2                            ! Or a double mouse click
  328.         GET(Queue,CHOICE(?List))                 !  Get the QUEUE element
  329.         GET(%Primary,FilePointer)              #<!  Get the record
  330.         Do UpdateProcedure                       ! Call the update procedure
  331.           #IF(%QueueRebuild)
  332.         Do FillQueue                             !  Fill the QUEUE
  333.           #ENDIF
  334.         #ENDIF
  335.         #IF(%HotBar)
  336.         GET(Queue,CHOICE(?List))                 ! Get the QUEUE element
  337.         GET(%Primary,FilePointer)              #<! Get the record
  338.         #ENDIF
  339.       END                                        ! End CASE keycode
  340.       #ENDIF
  341.     #ELSIF(%ScreenField = '?Exit')
  342.     OF ?Exit                                     !Process the Exit button
  343.       #IF(%ScreenFieldEdit)
  344.       %ScreenFieldEdit                         #<! Exit button Edit Routine
  345.       #ENDIF
  346.       DO ProcedureReturn
  347.     #ELSE
  348.     #INSERT(%ScreenEditRoutines)
  349.     #ENDIF
  350.   #ENDFOR
  351.     #INSERT(%PulldownEditRoutines)
  352.     END                                          !End CASE FIELD()
  353.     DISPLAY
  354.   END                                            !End LOOP
  355.   DO ProcedureReturn
  356.  
  357. FillQueue Routine
  358.  
  359.   #EMBED('Start of Fill Queue Routine')
  360.   FREE(Queue)                                  #<!Clear the QUEUE
  361.   Firstpage = 1                                  !Set the FirstPage flag
  362.   #IF(%ShowProg)                                #!If showing the progress
  363.   VEW::Length = 1                                !Set the status bar counter
  364.   #ENDIF
  365.   #FIX(%ScreenField,'?List')
  366.   #FOR(%ScreenFieldFix)
  367.   Line = %ScreenFieldFix                       #<!Add list box fields
  368.     #IF(%RecordOrder = %Null)
  369.       #IF(%FirstFieldSequence <> 'DESCENDING' AND %ReverseOrder = %Null)
  370.   CLEAR(QUE::%FirstField)                      #<!Clear the key field
  371.       #ELSE
  372.   CLEAR(QUE::%FirstField,1)                    #<!Clear the key field
  373.       #ENDIF
  374.     #ENDIF
  375.   ADD(Queue)                                     !Add the fixed line
  376.   DISPLAY(?List)                               #<!Blank the listbox
  377.   #ENDFOR
  378.   #IF(%RecordOrder)
  379.   SET(%Primary)                                #<!Set to file order
  380.   #ELSIF(%KeyRangeField)
  381.     #IF(%ReverseOrder)
  382.   #INSERT(%ClearRecordHigh)
  383.     #ELSE
  384.   #INSERT(%ClearRecordLow)
  385.     #ENDIF
  386.   %KeyRangeField = %RangeValue                 #<!Fill range field
  387.   SET(%PrimaryKey,%PrimaryKey)                 #<!Set to keyed order
  388.   #ELSE
  389.   SET(%PrimaryKey)                             #<!Set to keyed order
  390.   #ENDIF
  391.   #IF(%ShowProg)                                #!If showing the progress
  392.   VEW::ProgString = ALL(%ProgChar)             #<!Fill the progress string
  393.   #ENDIF
  394.   LOOP                                           !Get all selected records
  395.   #IF(%RecordOrder)
  396.     NEXT(%Primary)                             #<! Get the next record.
  397.   #ELSIF(%ReverseOrder)
  398.     PREVIOUS(%Primary)                         #<! Get the previous record
  399.   #ELSE
  400.     NEXT(%Primary)                             #<! Get the next record.
  401.   #ENDIF
  402.     IF ERRORCODE() THEN BREAK.                   ! Quit if an error occurs
  403.   #FIX(%File,%Primary)
  404.   #FIX(%Key,%PrimaryKey)
  405.   #IF(%KeyRangeField)                           #!If using a Range
  406.     #IF(%KeyNoCase)                             #!  Key is not case sensitive
  407.     IF (UPPER(%KeyRangeField) <> UPPER(%RangeValue)) #<! If not in Range
  408.     #ELSE
  409.     IF (%KeyRangeField <> %RangeValue)         #<! If not in Range
  410.     #ENDIF
  411.       BREAK                                    #<!  Break out of the Loop
  412.     END                                          ! End IF
  413.   #ENDIF
  414.   #IF(%RecordFilter)
  415.     IF ~(%RecordFilter)                        #<! If Filter condition not met
  416.       CYCLE                                      !  Try another record
  417.     END                                          ! End IF
  418.   #ELSE
  419.     #FOR(%Formula)
  420.       #IF(UPPER(%FormulaClass) = 'FILTER')
  421.         #IF(%FormulaType <> 'COMPUTED')
  422.     IF ~(%FormulaCondition)                    #<! If Filter condition not met
  423.       CYCLE                                      !  Try another record
  424.     END                                          ! End IF
  425.         #ELSE
  426.     IF ~(%FormulaComputation)                  #<! If Filter condition not met
  427.       CYCLE                                      !  Try another record
  428.     END                                          ! End IF
  429.         #ENDIF
  430.       #ENDIF
  431.     #ENDFOR
  432.   #ENDIF
  433.   #INSERT(%GetSecondaryRecords)
  434.   #FOR(%Formula)
  435.     #IF(UPPER(%FormulaClass) = 'LIST')
  436.     #INSERT(%GenerateFormula)
  437.     #ENDIF
  438.   #ENDFOR
  439.     #EMBED('LIST Class formula')
  440.   #IF(%ShowProg)                                #!If showing the progress
  441.     #INSERT(%ShowFileProgress)                  #!Insert the progress code
  442.   #ENDIF
  443.   #FIX(%ScreenField,'?LIST')
  444.     Line = %ScreenFieldExpression              #<! Fill the QUEUE line
  445.     FilePointer = POINTER(%Primary)            #<! Fill the file pointer
  446.   #FOR(%KeyField)
  447.     QUE::%KeyField =%KeyField                  #<! Fill the key field
  448.   #ENDFOR
  449.     ADD(Queue %SortString)                     #<! Add to the QUEUE
  450.     IF ERRORCODE() THEN BREAK.                   ! Quit out if error
  451.     IF FirstPage                                 ! If page 1
  452.       IF RECORDS(Queue) = ROWS(?List)            !  If we have a full screen
  453.         FirstPage = 0                            !   turn off the page flag
  454.       END                                        !  End IF
  455.       DISPLAY(?List)                             !  Display page 1
  456.     END                                          ! End IF
  457.     LOOP WHILE KEYBOARD()                        ! While Keyboard Input
  458.       SELECT(?List)                              !  Select the List box
  459.       ACCEPT                                     !  Accept a Key
  460.       IF KEYCODE() = EscKey                      !  If the Escape key
  461.         DO ProcedureReturn
  462.       END                                        !  End IF
  463.       DISPLAY(?List)                             !  Redisplay the list box
  464.     END                                          ! End LOOP
  465.   END                                            !End LOOP
  466.   #IF(%ShowProg)                                #!If showing the progress
  467.   CLEAR(StatusLine)
  468.   DISPLAY(?StatusLine)
  469.   #ENDIF
  470.   EXIT
  471.  
  472. #IF(%UpdateProc)
  473. UpdateProcedure  ROUTINE
  474.   #EMBED('Prior to Update Procedure')
  475.   %UpdateProc
  476.   #EMBED('After Update Procedure')
  477. #ENDIF
  478. #!
  479. !─────────────────────────────────────────────────────────────────────────────
  480. ProcedureReturn ROUTINE
  481.   #IF(%ShowProg)                                #!If showing the progress
  482.   ERASE(?StatusLine)                             !Clear the StatusLine
  483.   #ENDIF
  484.   DISPLAY                                        !Redisplay the screen
  485.   FREE(Queue)                                    !Free the Queue memory
  486.   #IF(%Pulldown)                                #!If a Pulldown exists
  487.   IF SAV::PullDownOpened
  488.     CLOSE(%Pulldown)                           #<!Close the Pulldown
  489.   END
  490.   #ENDIF
  491.   CLOSE(%Screen)
  492.   #INSERT(%FileControl)
  493.   DO EndOfProcedureEmbed
  494.   RETURN
  495. !─────────────────────────────────────────────────────────────────────────────
  496. EndOfProcedureEmbed ROUTINE
  497. #EMBED('End of Procedure')
  498. #EMBED('Custom Routines')
  499. #!***************************************************************************
  500. #GROUP(%ShowFileProgress)
  501. VEW::Length += 1
  502. StatusLine = ' Reading File: ' & SUB(VEW::ProgString,1,VEW::Length)
  503. IF VEW::Length = LEN(StatusLine) - 15
  504.   VEW::Length = 1
  505.   StatusLine = ' Reading File: ' & ' {65}'
  506. END
  507. Display(?StatusLine)
  508. #!
  509. #!***************************************************************************
  510. #GROUP(%ListErrorCheck)
  511. #!
  512. #IF(%Primary = %Null)
  513.   #SET(%ErrorMessage, (%Procedure & ' ERROR: No file has been chosen for this procedure.'))
  514.   #ERROR(%ErrorMessage)
  515.   #SET(%ErrorMessage, '  A file must be identified on the File Schematic.')
  516.   #ERROR(%ErrorMessage)
  517. #ENDIF
  518. #IF(%KeyRangeField)
  519.   #IF(UPPER(%KeyRangeField) = UPPER(%RangeValue))
  520.     #SET(%ErrorMessage, (%Procedure & ' ERROR: Range Limit Field and Range Value fields must'))
  521.     #ERROR(%ErrorMessage)
  522.     #SET(%ErrorMessage, '   be separate fields.')
  523.     #ERROR(%ErrorMessage)
  524.   #ENDIF
  525.   #IF(%KeyRangeField <> %Null and %RecordOrder <> %Null)
  526.     #SET(%ErrorMessage, (%Procedure & ' ERROR: Range Limits may only be used with keyed order.'))
  527.     #ERROR(%ErrorMessage)
  528.     #SET(%ErrorMessage, '   Record order has been selected.')
  529.     #ERROR(%ErrorMessage)
  530.   #ENDIF
  531. #ENDIF
  532. #!
  533. #!***************************************************************************
  534. #GROUP(%BuildListIndex)
  535. #FIX(%File, %Primary)
  536. #FIX(%Key, %PrimaryKey)
  537. #IF(%KeyIndex)
  538. BUILD(%PrimaryKey)                           #<!Build the index
  539. #ENDIF
  540. #!
  541. #!***************************************************************************
  542. #CHAIN('LOOKUP.TPX')
  543.